package ma.ensias.healthme.admin;

import ma.ensias.healthme.R;
import ma.ensias.healthme.dao.PersonneDao;
import ma.ensias.healthme.entities.Personne;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;

public class MyAlertDialogFragment extends DialogFragment {

		
        public static MyAlertDialogFragment newInstance(int title) {
            MyAlertDialogFragment frag = new MyAlertDialogFragment();
            Bundle args = new Bundle();
            args.putInt("title", title);
            frag.setArguments(args);
            return frag;
            
        }

        @Override
        public Dialog onCreateDialog(Bundle savedInstanceState) {
            int title = getArguments().getInt("title");

            return new AlertDialog.Builder(getActivity())
                    .setIcon(R.drawable.no_image)
                    .setTitle(title)
                    .setPositiveButton(R.string.oui,
                            new DialogInterface.OnClickListener() {
                                public void onClick(DialogInterface dialog,
                                        int whichButton) {
                                	((InfoCompteActivity) getActivity())
                                    .doPositiveClick();
                                }
                            })
                    .setNegativeButton(R.string.non,
                            new DialogInterface.OnClickListener() {
                                public void onClick(DialogInterface dialog,
                                        int whichButton) {
                                    ((InfoCompteActivity) getActivity())
                                            .doNegativeClick();
                                }
                            }).create();
        }
    }